﻿<UserControl x:Class="WpfRcp.Modules.Panels.Views.Controls.FirstTabView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             xmlns:Behaviors="clr-namespace:WpfRcp.Controls.Behaviors;assembly=WpfRcp.Controls"
             xmlns:Loc="clr-namespace:WpfRcp.Core.Common.Localization;assembly=WpfRcp.Core"
             Loc:ResxExtension.GlobalResxName="WpfRcp.Modules.Panels.Properties.Resources"
             xmlns:RcpControls="clr-namespace:WpfRcp.Controls;assembly=WpfRcp.Controls">

    <UserControl.Resources>

        <Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="True">
                    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="watermarkLabelStyle">
            <Setter Property="TextBlock.Foreground" Value="{x:Static SystemColors.ControlDarkBrush}" />
            <Setter Property="FrameworkElement.Opacity" Value="0.8" />
            <Setter Property="TextBlock.FontSize" Value="12" />
            <Setter Property="TextBlock.FontStyle" Value="Italic" />
            <Setter Property="TextBlock.Margin" Value="8,4,4,4" />
        </Style>

    </UserControl.Resources>

    <RcpControls:AccordionControl>

        <RcpControls:AccordionItem Header="{Loc:Resx Key=DisplayingFileContent}" IsSelected="True">

            <DockPanel>
                <GroupBox DockPanel.Dock="Top" Padding="5" VerticalAlignment="Top" BorderThickness="0" Background="Transparent">
                    <GroupBox.Header>
                        <Label Content="{Loc:Resx Key=DisplayingFileContent}"
                       FontSize="16" FontWeight="Bold" />
                    </GroupBox.Header>
                    <DockPanel>
                        <StackPanel>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="230" />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>

                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>

                                <Label Grid.Column="0" Grid.Row="0" Margin="3,3,3,3"
                                   Content="{Loc:Resx Key=FilePath}"/>
                                <TextBox Grid.Column="0" Grid.Row="1" Margin="3,3,3,3" VerticalContentAlignment="Center" IsReadOnly="True" Focusable="False"
                                 Text="{Binding Path=FileName, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                     Behaviors:WatermarkTextBoxBehavior.EnableWatermark="True"
                                     Behaviors:WatermarkTextBoxBehavior.Label="{Loc:Resx Key=EnterFilePath}"
                                     Behaviors:WatermarkTextBoxBehavior.LabelStyle="{StaticResource watermarkLabelStyle}">
                                </TextBox>
                                <Button Grid.Column="1" Grid.Row="1" Margin="3,3,3,3" Command="{Binding OpenFileCommand}" Width="75"
                                    Content="{Loc:Resx Key=Open}"></Button>
                                <Button Grid.Column="1" Grid.Row="2" Margin="3,3,3,3" Command="{Binding DisplayFileCommand}" Width="75"
                                    Content="{Loc:Resx Key=Display}"></Button>

                            </Grid>
                        </StackPanel>
                    </DockPanel>
                </GroupBox>
            </DockPanel>
        </RcpControls:AccordionItem>

        <RcpControls:AccordionSplitter />

        <RcpControls:AccordionItem Header="{Loc:Resx Options}" IsSelected="True">
        </RcpControls:AccordionItem>
    </RcpControls:AccordionControl>
</UserControl>
